package main

import (
	"fmt"
)

func producer(c chan int) {
	for i := 0; i < 10; i++ {
		fmt.Printf("Alice puts product, ID is : %d \n", i)
		c <- i
	}
	defer close(c)
}
func consumer(c chan int) {
	hasMore := true
	var p int
	for hasMore {
		if p, hasMore = <-c; hasMore {
			fmt.Printf("Bob gets product, ID is : %d \n", p)
		}
	}
}
//var wg sync.WaitGroup
func main() {
	c := make(chan int)
	//for i:=0;i<3;i++ {
	//	wg.Add(1)
		go producer(c)
		//wg.Done()
	//}
	//wg.Wait()
	 consumer(c)
}